package com.cnhis.cloudhealth.clinical.hosdoctor.doctorordernew.dao;

import com.cnhis.cloudhealth.clinical.hosnurse.hossendadvice.bo.HosSendAdviceBo;
import com.cnhis.cloudhealth.commons.dao.BaseDao;
import com.cnhis.cloudhealth.commons.utils.Page;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by xiezhenyuan on 2016/3/24.
 */
@Repository
public class DoctorordernewDao extends BaseDao {
	private Logger log=Logger.getLogger(HosSendAdviceBo.class);
    public Map getMaxSalePara(Map map) throws Exception {
        return (Map) queryForExtObject("Doctorordernew.getMaxSalePara", map);
    }
    public Map getMaxSale21Para(Map map) throws Exception {
        return (Map) queryForExtObject("Doctorordernew.getMaxSale21Para", map);
    }
    public Map getMaxSale22Para(Map map) throws Exception {
        return (Map) queryForExtObject("Doctorordernew.getMaxSale22Para", map);
    }
    public List<HashMap> getAllBLPList(Map map) throws Exception {
        return queryForList("Doctorordernew.getAllBLPList",map);
    }
    public List execProc(Map temp) throws Exception {
        return queryForList("Doctorordernew.execProc",temp);
    }
    public int getJudgeSsMz(List ls) throws Exception {
        return (Integer) queryForExtObject("Doctorordernew.getJudgeSsMz", ls);
    }
    public String getJudgeMzfs(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeMzfs", map);
    }
    public String getJudgeNoZd(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeNoZd", map);
    }
    public int getBlpBlp0230() throws Exception {
        return (Integer) queryForExtObject("Doctorordernew.getBlpBlp0230", null);
    }
    public String getJudgeNoQkdj(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeNoQkdj", map);
    }
    public int getJudNoTotal(Map map) throws Exception {
        return (Integer) queryForExtObject("Doctorordernew.getJudNoTotal", map);
    }
    public int getJudLydy(Map map) throws Exception {
        return (Integer) queryForExtObject("Doctorordernew.getJudLydy", map);
    }
    public String getJudgeKssYymd(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeKssYymd", map);
    }
    public List getJudgeOnlyXcy(Map map) throws Exception {
        return queryForList("Doctorordernew.getJudgeOnlyXcy", map);
    }
    public String getJudgeXsje(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeXsje", map);
    }
    public String getJudgeXssl(Map map) throws Exception {
        return (String) queryForExtObject("Doctorordernew.getJudgeXssl", map);
    }

    public List getCviZz(Map map) throws Exception {
        return queryForList("Doctorordernew.getCviZz", map);
    }
    public void addVBG1(Map map) throws Exception {
        insert("Doctorordernew.addVBG1", map);
    }
    public void delVAO1ByCBM01(Map map) throws Exception {
        delete("Doctorordernew.delVAO1ByCBM01", map);
    }
    public void delVBQ1ByCBM01(Map map) throws Exception {
        delete("Doctorordernew.delVBQ1ByCBM01",map);
    }
    public void delCBM1ByCBM01(Map map) throws Exception {
        delete("Doctorordernew.delCBM1ByCBM01", map);
    }
    public void delVAF1ByCBM01(Map map) throws Exception {
        delete("Doctorordernew.delVAF1ByCBM01", map);
    }
    public void insertCviCBM1(Map map) throws Exception {
        insert("Doctorordernew.insertCviCBM1", map);
    }

    public void insertCviVbq1(List ls) throws Exception {
        insert("Doctorordernew.insertCviVbq1", ls);
    }
    public void insertCviVaf1(Map map) throws Exception {
        insert("Doctorordernew.insertCviVaf1", map);
    }
    public void insertCviVao1(Map map) throws Exception {
        insert("Doctorordernew.insertCviVao1", map);
    }
    public void insertCviVbg1(Map map) throws Exception {
        insert("Doctorordernew.insertCviVbg1", map);
    }
    public List getCviKbmBDJ(Map map) throws Exception {
        return  queryForList("Doctorordernew.getCviKbmBDJ", map);
    }
    public void updateCviBdj1(Map map) throws Exception {
        update("Doctorordernew.updateCviBdj1", map);
    }
    public List getCviInDbj(Map map) throws Exception {
        return queryForList("Doctorordernew.getCviInDbj", map);
    }
    public void insertCviBdj1(Map map) throws Exception {
        insert("Doctorordernew.insertCviBdj1", map);
    }
    public void insertCviVax(List ls) throws Exception {
        insert("Doctorordernew.insertCviVax", ls);
    }
    public void insertCviVaf(List ls) throws Exception {
        insert("Doctorordernew.insertCviVaf", ls);
    }
    public Integer getCviHasVaa07(Map map) throws Exception {
        return (Integer) queryForExtObject("Doctorordernew.getCviHasVaa07", map);
    }
    public void updateCviVcj1(Map map) throws Exception {
        update("Doctorordernew.updateCviVcj1", map);
    }
    public void insertCviVcj1(Map map) throws Exception {
        insert("Doctorordernew.insertCviVcj1", map);
    }
    public void updateCviFromMzpara370(Map map) throws Exception {
        update("Doctorordernew.updateCviFromMzpara370", map);
    }

    public String getSysParamValue(Map map)throws Exception{
        return (String)this.queryToObject("Doctorordernew.getSysParamValue", map);
    }
    public Page getaParamno0List(Map map, int currentPage, int pageSize) throws Exception {
        return queryForPage("Doctorordernew.getaParamno0List", map,currentPage,pageSize);
    }
    public Page getaParamno8List(Map map, int currentPage, int pageSize) throws Exception {
        return queryForPage("Doctorordernew.getaParamno8List", map,currentPage,pageSize);
    }

    public Page getaParamnoe1List(Map map,int currentPage, int pageSize) throws Exception {
        return queryForPage("Doctorordernew.getaParamnoe1List", map,currentPage,pageSize);
    }
    public Page getaParamnoe2List(Map map,int currentPage, int pageSize) throws Exception {
        return queryForPage("Doctorordernew.getaParamnoe2List", map,currentPage,pageSize);
    }
    public Page getaParamnoeList(Map map, int currentPage, int pageSize) throws Exception {
        return queryForPage("Doctorordernew.getaParamnoeList", map,currentPage,pageSize);
    }
//    public List getaParamno0List(Map map) throws Exception {
//        return queryForList("Doctorordernew.getaParamno0List", map);
//    }
//    public List getaParamnoe1List(Map map) throws Exception {
//        return queryForList("Doctorordernew.getaParamnoe1List", map);
//    }
//    public List getaParamnoe2List(Map map) throws Exception {
//        return queryForList("Doctorordernew.getaParamnoe2List", map);
//    }
//    public List getaParamnoeList(Map map) throws Exception {
//        return queryForList("Doctorordernew.getaParamnoeList", map);
//    }
	public Map<String, List<Map<String, Object>>> selectsolrlist(Integer bck01,Integer corporationid,String dbname,Integer type) throws Exception {
		Map<String, Object> par = new HashMap<String,Object >();
		List<Map<String, Object>> listM = new ArrayList<Map<String, Object>>();
		List<Map<String, Object>> listT = new ArrayList<Map<String, Object>>();
		par.put("bck01", bck01);
		par.put("corporationid",corporationid);
		par.put("dbname",dbname);
		Map<String, List<Map<String, Object>>> mylist = new HashMap<String, List<Map<String, Object>>>();
		log.info("============================dbname===========================:"+dbname);
		if(type==2){
			listT = queryForList("Doctorordernew.selectsolrlistT",par);
		}else{
			listM = queryForList("Doctorordernew.selectsolrlistM",par);
		}
    		
    	mylist.put("listM", listM);
    	mylist.put("listT", listT);
    	log.info("============================mylist===========================:"+mylist.size());
        return mylist;
    }
	public Map sysParamValue()throws Exception{
		return (Map) queryForExtObject("Doctorordernew.sysParamValue", null);
	}
}
